<?php 
include('./fun.php');
$conn=my_sql($cfg);
$re=adm_login();
if($re['err']=='no_login'){die('<script>no_login()</script>');}
if($re['err']!='ok'){die('<hh><b>'.$re['err'].'</b></hh>');}
$adm=$re['adm'];
if($adm['power']!='adm'){err('抱歉，您没有查看的权限');}


?>
<style>

</style>

<adm_box>
<l><text>登录名</text>
<input placeholder="管理员登录名" c="username" need="1">
</l>

<l><text>登录密码</text>
<input placeholder="登录密码" c="pass" need="1">
</l>

<l><text>权限</text>
<a class="select" c="user" onclick="select_this_power($(this))">普通用户</a><a c="adm" onclick="select_this_power($(this))">管理员</a>
<input style="display:none;" placeholder="权限" c="power" need="1" value="user">
</l>

<l><a class="select" onclick="submit($(this))">添加</a></l>

</adm_box>
<script>
    
function select_this_power(o){
o.parent().find('a').removeClass('select');
o.addClass('select');
var val=o.attr('c');
o.parent().find('input').val(val);

}

function submit(){

var re=form_data($('adm_box input'));
if(re.can>0){return;}

post('adm_add',re.data,'',function(res){
    msg('添加成功');
    main_load();
    right_close();
    
});
}

</script>